package com.bzy.blp.upms.service.impl;

import java.util.Set;
import com.bzy.blp.upms.service.CommonService;
import com.bzy.blp.upms.service.RoleService;
import com.bzy.blp.upms.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;


@Service
public class CommonServiceImpl implements CommonService {

	private Logger logger = LoggerFactory.getLogger(CommonServiceImpl.class);

	@Resource
	private RoleService roleService;

//	@Resource
//	private AppService appService;

	@Resource
	private UserService userService;

	@Override
	public Long findAppId(String appKey) throws Exception {
//		return appService.findAppIdByAppKey(appKey);
		return null;
	}

	@Override
	public Long findUserId(String userName) throws Exception {
		return userService.findUseridByUsername(userName);
	}

	@Override
	public Set<String> findRoles(Long userId, Long appId) throws Exception {
		return roleService.findRoles(userId, appId);
	}

	@Override
	public Set<String> findPermissions(Long userId, Long appId) throws Exception {
		return roleService.findPermissions(userId, appId);
	}

}
